import time

import pytest
from appium import webdriver

from POappium.Base.basePage import basePage
from POappium.Search.searchPage import SearchPage
import unittest

class Test_Two(unittest.TestCase):
    def setUp(self):
        desired_caps = {}
        desired_caps['platformName'] = 'Android'
        desired_caps['platformVersion'] = '12'
        desired_caps['deviceName'] = '111'
        desired_caps['appPackage'] = 'app.lawnchair'
        desired_caps['appActivity'] = '.LawnchairLauncher'
        self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
        self.driver.implicitly_wait(10)
    #打开软件
    # @pytest.mark.api
    def test_01(self):
        search = SearchPage(self.driver)
        search.open()
        time.sleep(5)
    #登陆成功
    # def test_02(self):
    #     search = SearchPage(self.driver)
    #     search.open()
    #     search.login('18640260790', '115840207763')
    #发布笔记输入 标题 正文
    def test_03(self):
        search = SearchPage(self.driver)
        search.open()
        search.Fbj('wo', '111')

   # 购物全流程
    def test_10(self):
        search = SearchPage(self.driver)
        search.open()
        time.sleep(10)
        search.Gw('手机壳', '凤梨', '15710501311', '兴业家园1号楼')
    #删除笔记
    def test_05(self):
        search = SearchPage(self.driver)
        search.open()
        search.Sj()
    #修改我的昵称为凤梨
    def test_06(self):
        search = SearchPage(self.driver)
        search.open()
        search.Ewm("凤梨")
   #发布评论111
    def test_07(self):
        search = SearchPage(self.driver)
        search.open()
        search.Fbpl('111')
   # 添加地址
    def test_08(self):
        search = SearchPage(self.driver)
        search.open()
        search.Dz()
   # 搜索
    def test_09(self):
        search = SearchPage(self.driver)
        search.open()
        search.Sq('大疆')
   #  #加入购物车
    def test_04(self):
        search = SearchPage(self.driver)
        search.open()
        search.Jrgwc('手机壳')
    def tearDown(self):
        self.driver.quit()

if __name__ == '__main__':
    unittest.main()
    if __name__ == '__main__':
        runner = unittest.TextTestRunner(verbosity=2)
        suite = unittest.defaultTestLoader.discover('./Testcase', pattern='*test*.py')
        runner.run(suite)